//
//  ByUIProductActivityVC.m
//  oc_knowledge
//
//  Created by pro on 17/1/20.
//  Copyright © 2017年 com.itboye. All rights reserved.
//

#import "ByUIProductActivityVC.h"

@interface ByUIProductActivityVC ()

@end

@implementation ByUIProductActivityVC
{
    UIView      *_bgView;
    UIButton    *_okButton;
}
- (void)viewDidLoad {
    [super viewDidLoad];

    
    [self setupCommonUI];
    
    [self setupContentUI:0];
}
// 设置基本UI（背景视图，完成按钮）
- (void)setupCommonUI {
    
    _bgView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT - 200)];
    _bgView.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:_bgView];
    
    _okButton = [UIButton buttonWithType:UIButtonTypeCustom];
    _okButton.frame = CGRectMake(0, 0, _bgView.width, 40);
    _okButton.bottom = _bgView.height;
    _okButton.backgroundColor = rgba(250, 56, 9, 1);
    [_okButton setTitle:@"完成" forState:UIControlStateNormal];
    [_okButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [_okButton addTarget:self action:@selector(okAction) forControlEvents:UIControlEventTouchUpInside];
    [_bgView addSubview:_okButton];
}

- (void)setupContentUI:(int)type {
    
    CGFloat x, y, width, height;
    x = 0;
    y = 0;
    width = _bgView.width;
    height = 60;
    UILabel *notesLabel = [[UILabel alloc] initWithFrame:CGRectMake(x, y, width, height)];
    notesLabel.adjustsFontSizeToFitWidth = YES;
    notesLabel.font = FONT(16);
    notesLabel.text = @"基础服务";
    notesLabel.textColor = [UIColor blackColor];
    notesLabel.textAlignment = NSTextAlignmentCenter;
    [_bgView addSubview:notesLabel];
    
    x = 20;
    y = notesLabel.bottom;
    width = 20;
    height = width;
    UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(x, y, width, height)];
    imageView.image = [UIImage imageNamed:@"product_detail_checkmark"];
    [_bgView addSubview:imageView];
    
    x = imageView.right + 20;
    y = imageView.top;
    width = _bgView.width - x;
    height = imageView.height;
    UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(x, y, width, height)];
    titleLabel.adjustsFontSizeToFitWidth = YES;
    titleLabel.font = FONT(14);
    titleLabel.text = @"七天无理由退换";
    titleLabel.textColor = [UIColor darkGrayColor];
    titleLabel.textAlignment = NSTextAlignmentLeft;
    [_bgView addSubview:titleLabel];
    
    NSString *text = @"消费者在满足7天无理由退换申请的条件下，可以提出“7天无理由退换货”的申请";
    x = titleLabel.left;
    y = titleLabel.bottom;
    width = titleLabel.width;
    height = [text getRectOfStringWithSize:CGSizeMake(width, 10000) font:13].size.height;
    UILabel *subTitleLabel = [[UILabel alloc] initWithFrame:CGRectMake(x, y, width, height)];
    subTitleLabel.adjustsFontSizeToFitWidth = YES;
    subTitleLabel.font = FONT(13);
    subTitleLabel.numberOfLines = 0;
    subTitleLabel.text = text;
    subTitleLabel.textColor = [UIColor grayColor];
    subTitleLabel.textAlignment = NSTextAlignmentLeft;
    [_bgView addSubview:subTitleLabel];
}

- (void)okAction {
    
    [self dismissViewControllerAnimated:YES completion:nil];
}


@end
